package org.xs.big_event.controller;

import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.xs.big_event.service.impl.FileUpLoadService;
import org.xs.big_event.utils.R;

@RestController
@RequestMapping("/api/file")
public class FileUpLoadController {
    FileUpLoadService fileUpLoadService;
    public FileUpLoadController(FileUpLoadService fileUpLoadService) {
        this.fileUpLoadService = fileUpLoadService;
    }
    /**
     * 文件上传
     * @param file
     * @return 文件访问路径
     */
    @PostMapping("/upload")
    public R upload(MultipartFile file){
        return fileUpLoadService.upload(file);
    }
}
